#ifndef TREERENDER_H
#define TREERENDER_H
#include "common.h"
#include "treegen.h"
#include "treegen3d.h"
#include <GL/glu.h>


extern "C"{
    extern void APIENTRY glBindRenderbufferEXT (GLenum, GLuint);
    extern void APIENTRY glDeleteRenderbuffersEXT (GLsizei, const GLuint *);
    extern void APIENTRY glGenRenderbuffersEXT (GLsizei, GLuint *);
    extern void APIENTRY glActiveTexture (GLenum);
    extern void APIENTRY glFramebufferTexture2DEXT (GLenum, GLenum, GLenum, GLuint, GLint);
    extern void APIENTRY glRenderbufferStorageEXT (GLenum, GLenum, GLsizei, GLsizei);
    extern void APIENTRY glFramebufferRenderbufferEXT (GLenum, GLenum, GLenum, GLuint);
}

class TreeRender
{
public:
    TreeRender(Renderer *rend);
    void drawTree(TreeGen3D *tree, bool id_mode, int tree_color);
    void animateTree();
    void drawBranch(float3 start, float3 end, float phi, float theta, float length, float diameter);
    void recurDrawLeaf(Bud *b, bool flowers);
    void drawBud(Bud *b, bool term);
    void drawFlower(Bud *b, bool term);


    GLuint leaf, flower;
    Renderer * render;
    bool m_drawLeaves;
private:
         GLUquadric *mQuadric;
         void recurDraw(Bud *b, int tree_color);

};

#endif // TREERENDER_H
